/**
 * FireFly (2011)
 */
package com.firefly.kernel.plugins.bootstrap;

import com.firefly.kernel.KernelFactory;
import com.firefly.kernel.plugins.AbstractKernelObject;
import com.firefly.kernel.spi.config.IKernelConfig;

/**
 * 抽象核心引导类
 * 
 * @version 1.0 2011-1-2
 * @author lexloo(lexloo@gmail.com)
 * @since FireFly 1.0
 */
public abstract class AbstractBootstrap extends AbstractKernelObject implements Runnable {
	/** 核心配置 */
	protected IKernelConfig config;

	public AbstractBootstrap() {
	}

	/**
	 * 获取核心配置
	 * 
	 * @return 核心配置
	 */
	public IKernelConfig getConfig() {
		return this.config;
	}

	/**
	 * 设置核心配置
	 * 
	 * @param config
	 *            核心配置
	 */
	public void setConfig(IKernelConfig config) {
		this.config = config;
	}

	@Override
	public void run() {
		this.bootstrap();
	}

	/**
	 * 引导核心
	 */
	protected void bootstrap() {
		this.kernel = KernelFactory.newKernel(this.config);
	}
}
